const trigger = (el, type) => {
    const e = document.createEvent('HTMLEvents')
    e.initEvent(type, true, true)
    el.dispatchEvent(e)
};
export default {
    bind(el, binding, vNode) {
        if (!binding.value) {
            return;
        }
        let bindValue = binding.value;
        if (bindValue.negative === undefined) {
            bindValue.negative = true;
        }
        const input = el.getElementsByTagName('input')[0]
        input.onkeyup = function (e) {
            input.value = vNode.context.$XEUtils.DoubleInput(input.value, bindValue.len, bindValue.negative)
            trigger(input, 'input');
        }
        input.onblur = function (e) {
            input.value = vNode.context.$XEUtils.DoubleInput(input.value, bindValue.len, bindValue.negative)
            trigger(input, 'input');
        }
    }
};
